/*
 * @Author: 赛罗
 * @Date: 2024-02-29 11:06:37
 * @LastEditors: 赛罗
 * @LastEditTime: 2024-03-29 16:25:01
 * @FilePath: \haixiaoke-management-reconstruction\src\api\sys-role\enterprise-role.js
 * @Description:
 */
import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/manage/role/role/list',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/manage/role/role/' + roleId,
    method: 'get'
  })
}

// 查询后端创建的企业端角色信息列表
export function roleListByManage(params){
  return request({
    url:'/manage/role/role/listByManage',
    method: 'get',
    params
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/manage/role/role/add',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/manage/role/role/edit',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(roleId) {
  return request({
    url: '/manage/role/role/' + roleId,
    method: 'delete'
  })
}

// 查询该角色的菜单权限与所有菜单--树状结构
export function roleMenuTreeselect(roleId){
  return request({
    url:'/manage/role/role/roleMenuTreeselect/'+roleId,
    method: 'get',
  })
}

// 设置角色权限菜单
export function editMenuByRole(data) {
  return request({
    url: '/manage/role/role/editMenuByRole',
    method: 'put',
    data: data
  })
}

// 查询该角色的数据权限范围
export function permissionSelect(roleId){
  return request({
    url:'/manage/role/role/permissionSelect/'+roleId,
    method: 'get',
  })
}

// 设置角色的数据权限
export function editPermission(data) {
  return request({
    url: '/manage/role/role/editPermission',
    method: 'put',
    data: data
  })
}
